package com.zty.xiaomiadmin.server.Service.Tribunal;

import com.zty.xiaomiadmin.server.Dao.ServiceOrderMapper;
import com.zty.xiaomiadmin.server.Dao.TribunalMapper;
import com.zty.xiaomiadmin.server.Entity.Tribunal.Tribunal;
import com.zty.xiaomiadmin.server.utils.SqlSessionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;

import java.io.IOException;
import java.util.List;

@Service
public class TribunalServiceImp implements TribunalService {


    @Override
    public Tribunal getTribunalDetailById(int tribunal_id) throws IOException {
        return SqlSessionUtil.getSqlSessionInstance().getSqlSession()
                .getMapper(TribunalMapper.class).getTribunalDetailById(tribunal_id);
    }

    @Override
    public List<Tribunal> getMyTribunalByStoreId(int store_id, int pageIndex, int pageSize) throws IOException {
        return SqlSessionUtil.getSqlSessionInstance().getSqlSession()
                .getMapper(TribunalMapper.class).getMyTribunalByStoreId(store_id, pageIndex, pageSize);
    }

    @Override
    public List<Tribunal> getAllTribunal() throws IOException {
        return SqlSessionUtil.getSqlSessionInstance().getSqlSession()
                .getMapper(TribunalMapper.class).getAllTribunal();
    }

    @Override
    public int getMyTribunalByStoreIdNum(int store_id) throws IOException {
        return SqlSessionUtil.getSqlSessionInstance().getSqlSession()
                .getMapper(TribunalMapper.class).getMyTribunalByStoreIdNum(store_id);
    }
}